package com.host.dyyl;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;



/**
 * @author
 * @describe
 * @fileName CommonActivity
 * @date 2017/9/27 16:26
 */

public class WelcomeActivity extends Activity implements View.OnClickListener {

    private ImageView welcome_iv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_welcome);
        initWidget();
    }


    protected void initWidget() {
        welcome_iv = (ImageView) findViewById(R.id.welcome_iv);
        initWelcome();
    }

    private void initWelcome() {
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(welcome_iv, "alpha", 0.6f, 1.0f);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(2000);
        animatorSet.play(objectAnimator);
        animatorSet.start();
        animatorSet.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                startActivity(new Intent(WelcomeActivity.this, MainActivity3.class));
                finish();
            }

            @Override
            public void onAnimationCancel(Animator animator) {

            }

            @Override
            public void onAnimationRepeat(Animator animator) {

            }
        });
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case 0:
                break;
            default:
                break;
        }
    }
}
